package com.aabte.commons.errorcode.enums;

import com.aabte.commons.errorcode.BusinessExceptionAssert;
import org.springframework.http.HttpStatus;

/**
 * @author Daniel
 * @version 1.0
 * @date 2020/4/30
 */
public enum BaseResponseCode implements BusinessExceptionAssert {
    /**
     * OK
     */
    SUCCESS(HttpStatus.OK.value(), 0, HttpStatus.OK.getReasonPhrase()),

    BAD_REQUEST(HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase()),

    NOT_FOUND(HttpStatus.NOT_FOUND.value(), HttpStatus.NOT_FOUND.value(), HttpStatus.NOT_FOUND.getReasonPhrase()),

    INTERNAL_SERVER_ERROR(
            HttpStatus.INTERNAL_SERVER_ERROR.value(),
            1500,
            HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase());

    int status;
    int code;
    String message;

    BaseResponseCode(int status, int code, String message) {
        this.status = status;
        this.code = code;
        this.message = message;
    }

  @Override
  public int status() {
    return status;
  }

  @Override
  public int code() {
    return code;
  }

  @Override
  public String message() {
    return message;
  }
}
